package com.shop2cn.iapi.shenqisettlement.service;

import com.shop2cn.iapi.shenqisettlement.parameter.resp.GetCurrencyConfigResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

/**
 * 根据国家获取汇率Call FreeMaker Template自动生成代码
 */
public class GetCurrencyConfigCall extends YmatouBaseCall {
	private static String opurl = "/api/getCurrencyConfig";

	public GetCurrencyConfigCall() {
		super(EnvSetup.getSystemUrl("shenqisettlement_iapi"), opurl, "POST",
				"JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public GetCurrencyConfigResp getCurrencyConfigResp() {
		GetCurrencyConfigResp o =null;
		try {
		String result = getJsonObject().get("result").getAsJsonObject()
				.toString();
		o = (GetCurrencyConfigResp) FormatUtil
				.GSONToObject(result, GetCurrencyConfigResp.class);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return o;
	}
}